package org.vaadin.nf4v.core.handler;

import org.vaadin.nf4v.core.NavigableWindow;

/**
 * Factory used to create application window instances.
 * It's called when application window being requested first time or for new tab.
 *
 * OVERRIDING: cannot be overridden for context or page
 */
public interface WindowFactory extends Handler {

    /**
     * Note: do not set window name here, cause it will be overridden inside NavigableApplication logic,
     * cause window name not always exactly match context name (new tab case)
     *
     * Window theme may be also overridden by NavigableApplication logic (if it was configured)
     *
     * @param windowClass window class name (set in configuration)
     * @param contextName context name
     * @return navigable window instance
     */
    <T extends NavigableWindow> T createWindow(Class<T> windowClass, String contextName);
}
